package com.example.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyException {

    @ExceptionHandler(Exception.class)
    public Object exceptionHandler(Exception e) {
        String message = e.getMessage();
        System.out.println(message);
        return message;
    }
}
